﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using DataAccessClass;

namespace ProducerBO
{
    public class PAYMENT
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _PAY_ID = -99;
        private long _S_ID = -99;
        private string _PAY_TYPE = "";
        private long _CARD_NO = -99;
        private string _CARD_NAME = "";
        private long _AMOUNT = -99;
        //private decimal _AMOUNT = -99;
        private bool _ISDELETED = false;
        private bool _ISDUE = true;
        
        public bool ISDELETED
        {
            get
            {
                return _ISDELETED;
            }
            set
            {
                _ISDELETED = value;
            }
        }
        public bool ISDUE
        {
            get
            {
                return _ISDUE;
            }
            set
            {
                _ISDUE = value;
            }
        }
        public long PAY_ID
        {
            get
            {
                return _PAY_ID;
            }
            set
            {
                _PAY_ID = value;
            }
        }
        public long S_ID
        {
            get
            {
                return _S_ID;
            }
            set
            {
                _S_ID = value;
            }
        }
        public string PAY_TYPE
        {
            get
            {
                return _PAY_TYPE;
            }
            set
            {
                _PAY_TYPE = value;
            }
        }
        public long CARD_NO
        {
            get
            {
                return _CARD_NO;
            }
            set
            {
                _CARD_NO = value;
            }
        }
        
        public string CARD_NAME
        {
            get
            {
                return _CARD_NAME;
            }
            set
            {
                _CARD_NAME = value;
            }
        }
        public long AMOUNT
        {
            get
            {
                return _AMOUNT;
            }
            set
            {
                _AMOUNT = value;
            }
        }

        public long SaveRecord()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@PAY_ID", PAY_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@S_ID", S_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@PAY_TYPE", PAY_TYPE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@CARD_NO", CARD_NO, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@CARD_NAME", CARD_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@AMOUNT", AMOUNT, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@ISDUE", ISDUE, DbType.Boolean, ParameterDirection.Input);


                DbParameter dbparam7 = DAC.Parameter("@ISDELTED", ISDELETED, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7 };
                return DAC.Save("PAYMENT_SAVE", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long CLIPD_ID, long CLIP_ID,long CLIPD_S_ID,string CLIPD_PHOTO,string CLIPD_FORMAT,string CLIPD_LENGTH,string CLIPD_SIZE,long CLIPD_PRICE, bool ISDELETED, bool ISACTIVE,string andor) 
        {
            try
            {
                 DbParameter dbparam0 = DAC.Parameter("@PAY_ID", PAY_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@S_ID", S_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@PAY_TYPE", PAY_TYPE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@CARD_NO", CARD_NO, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@CARD_NAME", CARD_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@AMOUNT", AMOUNT, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@ISDUE", ISDUE, DbType.Boolean, ParameterDirection.Input);


                DbParameter dbparam7 = DAC.Parameter("@ISDELTED", ISDELETED, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam8= DAC.Parameter("@paraandor", andor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7,dbparam8};
                DataTable dt = DAC.Select("PAYMENT_GET", dbparamcall);
                return dt;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }

    }
}
